cmake_minimum_required(VERSION 3.16)

project(QrGame LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

add_executable(QrGame
  main.cpp
  Game.h
  Game.cpp
  Entity.h
  Sprite.h Sprite.cpp
  Manager.h
  resource.qrc
  Map.h Map.cpp
  PlayerPlane.h PlayerPlane.cpp
  Bullett.h Bullett.cpp
  Enemyplane.h Enemyplane.cpp
  global.h
)
target_link_libraries(QrGame Qt${QT_VERSION_MAJOR}::Widgets)

include(GNUInstallDirs)
install(TARGETS QrGame
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
